package com.jews.jpa.support;

import lombok.Data;

@Data
public class AbstractBaseJpaVO {
    /**
     * 数据版本号
     */
    private int version;
    /**
     * 主键
     */
    private Long id;
    /**
     * 创建时间
     */
    private Long createdAt;
    /**
     * 修改时间
     */
    private Long updatedAt;

    protected AbstractBaseJpaVO(BaseJpaAggregate source) {
        this.setVersion(source.getVersion());
        this.setId(source.getId());
        this.setCreatedAt(source.getCreatedAt().toEpochMilli());
        this.setUpdatedAt(source.getUpdatedAt().toEpochMilli());
    }

    protected AbstractBaseJpaVO() {
    }
}